class apacheflume::install {
  case $facts['os']['release']['major'] {
    '6': {
      package { "jdk":
        ensure  => "installed",
        require => Yumrepo['site']
      }
      package { "filebeat":
        ensure  => "installed",
        require => Yumrepo['site']
      }
      package { "filebeat-config-ihep-default":
        ensure  => "installed",
        require => Yumrepo['site']
      }
    }
    '7': {
      package { "jdk1.8":
        ensure  => "installed",
        require => Yumrepo['site']
      }
      package { "filebeat":
        ensure  => "installed",
        require => Yumrepo['site']
      }
      package { "filebeat-config-ihep-default":
        ensure  => "installed",
        require => Yumrepo['site']
      }
    }
    /8|9/: {
      file {'/etc/init.d':
        ensure   => link,
        force  => true,
        target   => "rc.d/init.d",
      }->
      package { "java-latest-openjdk":
        ensure  => "installed",
        require => Yumrepo['site']
      }->
      package { "chkconfig":
        ensure  => "installed",
        require => Yumrepo['site']
      }->
      package { "filebeat":
        ensure  => "installed",
        require => Yumrepo['site']
      }->
      package { "filebeat-config-ihep-default":
        ensure  => "installed",
        require => Yumrepo['site']
      }
    }

  }
}
